package com.tony.concurrent.BlockQueneTest;

import java.util.concurrent.BlockingQueue;

public class Consumer implements Runnable {
    private BlockingQueue blockingQueue;
    public Consumer(BlockingQueue blockingQueue){
        this.blockingQueue = blockingQueue;
    }
    @Override
    public void run() {
        try {
            for(int i=0;i<10;i++){
                System.out.println("consumer take:"+blockingQueue.take());
                Thread.sleep(200);
            }
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
